package laba4;

import interfaces.task4.CollectionUtils;
import interfaces.task4.MapUtils;
import java.util.ArrayList;
import java.util.Collection;

/**
 *
 * @author yakimovich
 */
public class CollectionAndMapUtilsTest {

    /**
     *
     * @param args
     */
    public static void main(String[] args) {
        CollectionUtils cu = new CollectionUtilsImpl();
        MapUtils mu = new MapUtilsImpl();

        Collection<Integer> c0 = new ArrayList<>();
        c0.add(0);
        c0.add(1);
        c0.add(1);
        c0.add(2);

        Collection<Integer> c1 = new ArrayList<>(c0);
        c1.add(3);
        c1.add(4);
        c1.add(9);

        Collection<Integer> c2 = new ArrayList<>(c0);
        c2.add(1);
        c2.add(5);
        Collection<Integer> c3 = new ArrayList<>();

        System.out.println("Demonstration of operations on Collections: \n");

        System.out.printf("%-20s %-15s %n", "First Collection: ", c1);
        System.out.printf("%-20s %-15s %n", "Second Collection: ", c2);

        System.out.println();
//
        System.out.print("Union: ");
        System.out.println(cu.union(c1, c2));

        System.out.print("Intersection: ");
        System.out.println(cu.intersection(c1, c2));

        System.out.print("IntersectionWithoutDuplicate: ");
        System.out.println(cu.intersectionWithoutDuplicate(c1, c2));

        System.out.print("Difference: ");
        System.out.println(cu.difference(c1, c2));

        System.out.println("***************************");
        System.out.println("Demonstration of a frequency dictionary: \n");

        System.out.println("The specified string:");
        String s = "73df; ddddddl iiiisb ap bb89o54sdddddllsdd";
        System.out.println(s);
        System.out.println();
        System.out.println("The frequency dictionary for triplets: ");
        System.out.println(mu.findThrees(s));

        System.out.println("***************************");
    }
}
